package controller;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

public class SurveyServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        String city = req.getParameter("city");
        List<String> languages = Arrays.asList(req.getParameterValues("languages"));

        req.setAttribute("name", name);
        req.setAttribute("city", city);
        req.setAttribute("languages", languages);

        RequestDispatcher dispatcher = req.getRequestDispatcher("question.jsp");
        dispatcher.forward(req, resp);
    }
}
